package com.eliaukjq.xunlianying;

/**
 * @Author : 佩萁
 * Description :
 * @Create : 2024/7/9 - 17:54
 */
public class MethodDemo {
    public static void main(String[] args) {
        MethodDemo demo = new MethodDemo();
        demo.method1();
    }

    private synchronized void method1() {
        System.out.println(Thread.currentThread().getName() + ": method1()");
        method2();
    }

    private synchronized void method2() {
        System.out.println(Thread.currentThread().getName() + ": method2()");
        method3();
    }

    private synchronized void method3() {
        System.out.println(Thread.currentThread().getName() + ": method3()");
    }
}
